package com.arron.java基础.流.testio5;

import java.io.*;
//数据流
public class TestIO5 {
    public static void main(String[] args) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(baos);
        long m = 1234567;
        dos.writeLong(m);
        dos.flush();

        //网络传输


        byte[] buf2 = baos.toByteArray();
        ByteArrayInputStream bais = new ByteArrayInputStream(buf2);
        DataInputStream dis = new DataInputStream(bais);
        long n;
        n = dis.readLong();
        System.out.println("n = " + n);
    }
}
